#ifndef SIM_GRAPHIC_DATA_H
#define SIM_GRAPHIC_DATA_H

#include "graphicdata.h"

#include <nettypes.h>

namespace wfnet
{
class WfNet;
}

namespace swp
{
class ISimItem;
class SwpSimActivityGraphicItem;

class SimGraphicData : public GraphicData
{
    Q_OBJECT

public:
    SimGraphicData();
    ~SimGraphicData();

    QList<QUuid> simPath() const;
    void tryToCreateSimPath(const QList<QUuid>& simPath);

    void setCurrentState(core::IEditor::State state);
    void clearData(const QList<core::IEditorItem* >& preserve =
            QList<core::IEditorItem* >());

    bool isNetDirty() const;
    wfnet::WfNet* net() const;
    void updateNet();

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent* event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);

private:
    void tryToAddToSimPath(ISimItem* item,
        core::IGraphicEditorItem* _item);
    void tryToRemoveFromSimPath(ISimItem* item,
        core::IGraphicEditorItem* _item);

    void checkSimPath();
    void clearSimpath(int index = 0);

signals:
    void validChanged(bool valid);

private:
    friend class BuildSimPathCommand;
    friend class ReportBuilder;
    friend class SwpSimulationCaseDocument;
    friend class WorkflowNetGenerator;
    QList<QUuid> m_simPath;
    QList<QUuid> m_oldSimPath;
    bool m_simPathEdit;
    wfnet::WfNet* m_net;
    bool m_isNetDirty;
    QHash<net::nid, const SwpSimActivityGraphicItem* > m_reportMapping;
    net::nid m_endPlace;
};

} // namespace swp

#endif
